package com.yunxin.customui.bean.condition;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * 前台条件下拉框组件的父类
 */
@AllArgsConstructor
@NoArgsConstructor
public abstract class UIModule implements Serializable {
    private static final String STRING_SPLIT = "&&";
    /**
     * 组件描述
     */
    @Getter@Setter
    String moduleLabel;

    /**
     * 尾标签
     */
    @Getter@Setter
    String tailLabel;

    /**
     * 默认值
     */
    String[] defaultValue;

    /**
     * 组件id
     */
    @Getter@Setter
    String moduleId;

    @Getter@Setter
    String type;

    /**
     * 对应的属性 名字
     * 当下拉框的值传到后台时，这个值所对应的属性名字
     */
    String[] attrName;

    public String[] getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(String[] defaultValue) {
        this.defaultValue = defaultValue;
    }

    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue.split(STRING_SPLIT);
    }

    public String[] getAttrName() {
        return attrName;
    }

    public void setAttrName(String[] attrName) {
        this.attrName = attrName;
    }

    public void setAttrName(String attrName) {
        this.attrName = attrName.split(STRING_SPLIT);
    }

}
